import Vue from 'vue';
import VueRouter from 'vue-router';
//主体
//import App from './components/app.vue';
//路由切换页面

import Layout from './components/layout.vue'
import Detail from './components/detail.vue'
import Index from './components/index.vue'
import Login from './components/login.vue'
//安装插件
Vue.use(VueRouter); //挂载属性

//创建路由对象并配置路由规则
let router = new VueRouter({
    //routes
    routes: [{
            path: '/',
            component:Index
        },
// 		{
//             path: '/detail',
//             component:Detail
//         },
	    {
            path: '/detail/:id',
            component:Detail
        },
		 {
		    path: '/login',
		    component:Login
		},

    ]
});






//new Vue 启动
new Vue({
    el: '#app',
    //让vue知道我们的路由规则
    router, //可以简写router
    render: c => c(Layout),
})